<template>
  <div id="app-container" style="padding: 20px; font-family: Arial, sans-serif;">
    <h1 style="color: #4CAF50; text-align: center;">🐱 ReadCat 测试成功！</h1>
    
    <div style="background: #f5f5f5; padding: 20px; border-radius: 10px; margin: 20px 0;">
      <h2>✅ Vue 应用状态</h2>
      <p><strong>Vue 版本:</strong> {{ vueVersion }}</p>
      <p><strong>当前时间:</strong> {{ currentTime }}</p>
      <p><strong>计数器:</strong> {{ counter }}</p>
      <button @click="increment" style="background: #4CAF50; color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer;">
        点击增加计数
      </button>
    </div>

    <div style="background: #e3f2fd; padding: 20px; border-radius: 10px; margin: 20px 0;">
      <h2>🔧 系统信息</h2>
      <p><strong>用户代理:</strong> {{ userAgent }}</p>
      <p><strong>页面 URL:</strong> {{ pageUrl }}</p>
      <p><strong>全局变量检查:</strong></p>
      <ul>
        <li>GLOBAL_IPC: {{ globalIpcStatus }}</li>
        <li>GLOBAL_LOG: {{ globalLogStatus }}</li>
        <li>METADATA: {{ metadataStatus }}</li>
      </ul>
    </div>

    <div style="background: #fff3e0; padding: 20px; border-radius: 10px; margin: 20px 0;">
      <h2>🎉 测试结果</h2>
      <p style="color: #4CAF50; font-size: 18px; font-weight: bold;">
        如果你能看到这个页面，说明 Vue 应用已经成功挂载和运行！
      </p>
      <p>这意味着基础的 Vue + Vite 环境是正常工作的。</p>
    </div>

    <div style="background: #ffebee; padding: 20px; border-radius: 10px; margin: 20px 0;">
      <h2>🔍 下一步调试</h2>
      <p>现在我们知道 Vue 应用可以正常运行，问题可能出现在：</p>
      <ul>
        <li>Core.init() 初始化过程</li>
        <li>某些依赖模块的加载</li>
        <li>TypeScript 编译错误</li>
        <li>路由配置问题</li>
      </ul>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue';

const vueVersion = ref('Vue 3');
const currentTime = ref('');
const counter = ref(0);
const userAgent = ref('');
const pageUrl = ref('');
const globalIpcStatus = ref('未检测到');
const globalLogStatus = ref('未检测到');
const metadataStatus = ref('未检测到');

const increment = () => {
  counter.value++;
};

const updateTime = () => {
  currentTime.value = new Date().toLocaleString('zh-CN');
};

onMounted(() => {
  updateTime();
  setInterval(updateTime, 1000);
  
  userAgent.value = navigator.userAgent;
  pageUrl.value = window.location.href;
  
  // 检查全局变量
  if ((window as any).GLOBAL_IPC) {
    globalIpcStatus.value = '✅ 已设置';
  }
  if ((window as any).GLOBAL_LOG) {
    globalLogStatus.value = '✅ 已设置';
  }
  if ((window as any).METADATA) {
    metadataStatus.value = '✅ 已设置';
  }
  
  console.log('🎉 Vue 应用组件已成功挂载！');
});
</script>

<style scoped>
button:hover {
  background: #45a049 !important;
}
</style>